#include <iostream>
using namespace std;
int main()
{
    int n, nums[5];
    for (int i = 0; i < 3; i++)
    {
        cin >> n;
        if (i == 0)
            cout << "#";
        if (n == 0)
            cout << "00";
        int j = 0;
        while (n)
        {
            nums[j++] = n % 13;
            n /= 13;
        }
        if (j == 1)
            cout << 0;
        for (int p = j - 1; p >= 0; p--)
        {
            if (nums[p] >= 10)
                cout << char('A' + nums[p] - 10);
            else
            {
                cout << nums[p];
            }
        }
    }
    return 0;
}